﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GuidingRobot;
using OperateWebcam;


namespace my_BitmapProcess_Test
{
    public partial class Form1 : Form
    {

        private IOperateWebcam ow;
        //private HighPerformanceTimer mytimer;

        public Form1()
        {
            InitializeComponent();
            // ow = new VideoForWindows(pictureBox1.Handle, pictureBox1.Width, pictureBox1.Height);
            // ow = new DirectShow(Convert.ToInt32(textBox2.Text), pictureBox1);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ITypeReco tb = new BitmapProcessITypeReco();
            textBox1.Text = tb.GetLabelType(Application.StartupPath + @"\test.jpg").ToString()+"\r\n";

            /*
            mytimer = new HighPerformanceTimer();

            mytimer.Start();
            IRobotGo rg = new BitmapProcessIRobotGoDAV(Application.StartupPath + @"\path.jpg");
            textBox1.Text += "转动角度：" + rg.SetRobotGoAngle().ToString() + "\r\n" +
                "偏转方向：" + rg.SetRobotGoDirection().ToString() + "\r\n";
            mytimer.Stop();

            textBox1.Text += mytimer.Duration.ToString("####.##") + "毫秒";
             */

            // IRobotGoSV rg = new BitmapProcessIRobotSV(Application.StartupPath + @"\test.jpg");
            // textBox1.Text = rg.SetRobotGoScale().ToString();

            IRobotSpeaking rs = new RobotSpeaking(Application.StartupPath + @"\展板文件.txt");
            textBox1.Text += rs.Speak(Convert.ToInt32(textBox2.Text));

        }

        private void btnOpen_Click(object sender, EventArgs e)
        {
            ow = new DirectShow(Convert.ToInt32(textBox2.Text), pictureBox1);
            ow.Start();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            ow.Close();
        }

        private void btnGrab_Click(object sender, EventArgs e)
        {
            ow.Grab(Application.StartupPath + @"\test.jpg");
        }


    }
}
